package com.pro.system.entity;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

@Entity
@Data
@Table(name = "comment")
public class Comment {

    @Id
    private Integer commentId;    //评论ID


    private String content;  //评论内容


    private Integer score;    //评分

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date date ;   //评论时间

    @ManyToOne(
            fetch = FetchType.LAZY,
            cascade = {
                    CascadeType.DETACH,
                    CascadeType.MERGE,
                    CascadeType.PERSIST,
                    CascadeType.REFRESH
            }
    )
    @JoinColumn(name = "user_id")
    private User user;

}
